<div id="stream_permission_settings" class="stream-permissions {{#if is_stream_edit}}settings-subsection-parent{{/if}}">
    {{#if is_stream_edit}}
        <div class="subsection-header">
            <h3 class="stream_setting_subsection_title">{{t "Channel permissions" }}
            </h3>
            {{> ../settings/settings_save_discard_widget section_name="stream-permissions" }}
        </div>
        <div class="stream-permissions-warning-banner"></div>
    {{/if}}

    <div class="input-group stream-privacy-values">
        <div class="alert stream-privacy-status"></div>
        <label>{{t 'Who can access the channel?'}}
            {{> ../help_link_widget link="/help/channel-permissions" }}
        </label>

        <div class="stream-privacy_choices prop-element" id="id_stream_privacy" data-setting-widget-type="radio-group" data-setting-choice-type="string">
            {{#each stream_privacy_policy_values}}
                <div class="settings-radio-input-parent">
                    <label class="radio">
                        <input type="radio" name="privacy" value="{{ this.code }}" {{#if (eq this.code ../stream_privacy_policy) }}checked{{/if}} />
                        <b>{{ this.name }}:</b> {{ this.description }}
                    </label>
                </div>
            {{/each}}
        </div>
    </div>

    {{#if ask_to_announce_stream}}
        <div id="announce-new-stream">
            {{>announce_stream_checkbox }}
        </div>
    {{/if}}

    <div class="default-stream">
        {{> ../settings/settings_checkbox
          prefix="id_"
          setting_name="is_default_stream"
          is_checked=check_default_stream
          label=(t "Default channel for new users")
          help_link="/help/set-default-channels-for-new-users"
          }}
    </div>
</div>

<div id="stream-advanced-configurations" class="advanced-configurations-container stream-permissions {{#if is_stream_edit}}settings-subsection-parent{{/if}}">
    <div class="advance-config-title-container {{#if is_stream_edit}}subsection-header{{/if}}">
        <i class="fa fa-sm fa-caret-right toggle-advanced-configurations-icon" aria-hidden="true"></i>
        <h4 class="stream_setting_subsection_title"><span>{{t 'Advanced configurations' }}</span></h4>
        {{#if is_stream_edit}}
            {{> ../settings/settings_save_discard_widget section_name="stream-permissions" }}
        {{/if}}
    </div>
    <div class="advanced-configurations-collapase-view hide">

        <div class="input-group">
            <label class="dropdown-title">{{t 'Who can post to the channel?'}}
                {{> ../help_link_widget link="/help/stream-sending-policy" }}
            </label>
            <select name="stream-post-policy" class="stream_post_policy_setting prop-element settings_select bootstrap-focus-style" id="id_stream_post_policy" data-setting-widget-type="number">
                {{#each stream_post_policy_values}}
                    <option value="{{this.code}}" {{#if (eq this.code ../stream_post_policy) }}selected{{/if}}>
                        {{ this.description}}
                    </option>
                {{/each}}
            </select>
        </div>

        {{> ../dropdown_widget_with_label
          widget_name=can_remove_subscribers_setting_widget_name
          label=(t 'Who can unsubscribe others from this channel?')
          value_type="number"}}

        {{#if (or is_owner is_stream_edit)}}
            <div>
                <div class="input-group inline-block message-retention-setting-group time-limit-setting">
                    <label class="dropdown-title">{{t "Message retention period" }}
                        {{> ../help_link_widget link="/help/message-retention-policy" }}
                    </label>

                    {{> ../settings/upgrade_tip_widget}}

                    <select name="stream_message_retention_setting"
                      class="stream_message_retention_setting prop-element settings_select bootstrap-focus-style"
                      id="id_message_retention_days"
                      data-setting-widget-type="message-retention-setting">
                        <option value="realm_default">{{t "Use organization level settings {org_level_message_retention_setting}" }}</option>
                        <option value="unlimited">{{t 'Retain forever' }}</option>
                        <option value="custom_period">{{t 'Custom' }}</option>
                    </select>

                    <div class="dependent-settings-block stream-message-retention-days-input">
                        <label class="inline-block">
                            {{t 'Retention period (days)' }}:
                        </label>
                        <input type="text" autocomplete="off"
                          name="stream-message-retention-days"
                          class="stream-message-retention-days message-retention-setting-custom-input time-limit-custom-input"
                          id="stream_message_retention_custom_input" />
                    </div>
                </div>
            </div>
        {{/if}}
    </div>
</div>
